package com.ksc.storekeeper.shared.dto;

import java.util.Date;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.view.client.ProvidesKey;
import com.ksc.storekeeper.shared.enums.Category;


public class ProductDTO implements IsSerializable,Comparable<ProductDTO>{
	
	public static ProvidesKey<ProductDTO> KEY_PROVIDER= new ProvidesKey<ProductDTO>() {

		@Override
		public Object getKey(ProductDTO item) {
			return item==null?null:item.getId();
		}
	};
	private String name;
	
	private String code;
	
	private Category category;
	
	private String description;
	
	private String imageUrl;

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}
	
   private int version;
	
	private Date created;
	
	private Date lastModified;
	
	private Long id;

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Date getLastModified() {
		return lastModified;
	}

	public void setLastModified(Date lastModified) {
		this.lastModified = lastModified;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Override
	public int compareTo(ProductDTO o) {
		return getCode().compareTo(o.getCode());
	}
	
}
